package com.eh.factory.abstractFactory.pizza;

import com.eh.factory.abstractFactory.factory.PizzaIngredientFactory;
import com.eh.factory.abstractFactory.ingredient.Dough;
import com.eh.factory.abstractFactory.ingredient.Sauce;

/**
 * Created by David on 2016/4/26.
 */
public abstract class Pizza {
    protected PizzaIngredientFactory pizzaIngredientFactory;

    protected String name;
    protected Dough dough;
    protected Sauce sauce;

    public Pizza(PizzaIngredientFactory pizzaIngredientFactory) {
        this.pizzaIngredientFactory = pizzaIngredientFactory;
        dough = pizzaIngredientFactory.createDough();
        sauce = pizzaIngredientFactory.createSauce();
    }

    public void prepare() {
        System.out.printf("准备 [%s]...%n", name);
        System.out.printf("搅拌面团[%s, %s]...%n", dough.getName(), dough.getKind());
        System.out.printf("添加酱料[%s, %s]...%n", sauce.getName(), sauce.getKind());
    }

    public void bake() {
        System.out.println("烘烤 20 分钟...");
    }

    public void cut() {
        System.out.println("剪切...");
    }

    public void box() {
        System.out.println("打包...");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Dough getDough() {
        return dough;
    }

    public void setDough(Dough dough) {
        this.dough = dough;
    }

    public Sauce getSauce() {
        return sauce;
    }

    public void setSauce(Sauce sauce) {
        this.sauce = sauce;
    }
}
